# <- this is for comment / total file size must be less than 4KB



#erase signature bank
spi_wp 0
spi_ws 0xFF00
spi_eb 0x1c0000 0x01d0000
spi_eb 0x1f0000 0x0200000
spi_rs
#mboot
#For rework update mboot_spi.bin, use below part
#fatload usb 0:1 80400000 mboot_spi.bin
#spi_rdc 0x80430300 0x00030300 0x00000C4
#spi_wrc 0x80400000 0x00000000 0x01C0000
#spi_wrc 0x805F0000 0x001F0000 0x0010000

#For mboot_spi.bin (padded to 2MB, added logo, edid/ddr etc) upgrade, use below part
#fatload usb 0:1 80400000 mboot_spi.bin
#spi_wrc 0x80400000 0x00000000 0x0200000


#mb90.
#For Core update comment below line
nand erase
fatload usb 0:1 80400000 mb90_en.bin
#crc32 0x80400000 0x01920014 0x81F00000
dectest aesecb 0x80400000 0x06C01220

## Must erase NAND before making factory.bin
#nand bad
#nand scrub
#nand bad

## Add fake bad block BEFORE making factory.bin ONLY!!!
## 0x10 = 16; 16x512x32=0.25M
## "rsv" command is available since mboot V105
#rsv bad KL A
#rsv bad CONF 10
#rsv bad UBIA 10

#set partition
dynpart edb64M-nand:0x500000(KL),0xFA0000(CONF),0x7200000(UBIA),0x7860000(UBIB),-(NA)
saveenv

#kernel
#For Core update uncomment below line
nand erase KL
nand write.e 0x80400010 KL 0x500000

#For Core update uncomment below line
#nand erase UBIA
ubi part UBIA
ubi create RFS 0xBA0000
ubi create VEN 0x5898000

#ROOTFS
ubi write 0x80900010 RFS 0xB00000

#VENDOR
ubi write 0x81400010 VEN 0x5600000

#CLEAN CRC32
#mw 0x81000000 0xFFFFFFFF 0x04
#spi_wrc 0x81000000 0xF1000 0x04

#CRC32 Create
#ubifsmount VEN
#ubifsload 0x82000000 /vendor/aurora.elf
#crc32 0x82000000 0x000000 0x81F00000
#md 0x81F00000
#spi_wrc 0x81F00000 0xF1000 0x04

#For Core update comment following 3 lines
#nand erase CONF
ubi part CONF
ubi create CON 0x953000
ubi write 0x86A00010 CON 0x600000

#Write Signature 87000010
store_secure_info kernelSign 0x87000010
store_secure_info ROOTFSSign 0x87000120
store_secure_info applicationsSign 0x870009A0

#bootargs
#setenv filesize 350000
#setenv fileaddr 80400000
#Note: EMAC_MEM must be right after LX_MEM!!!
setenv MS_UBI ubi.mtd=1 ubi.mtd=2,2048 root=ubi1:RFS rootfstype=ubifs ro
setenv MS_MEM EMAC_MEM=0x200000 DRAM_LEN=0x20000000 LX_MEM=0x06F30000 LX_MEM2=0x65C64000,0x5CFC000
#setenv MS_MEM EMAC_MEM=0x200000 DRAM_LEN=0x20000000 LX_MEM=0x06FF0000
setenv bootargs console=ttyS0,115200 quiet lpj=831488 $(MS_UBI) $(mtdparts) $(MS_MEM)
saveenv

#Set MAC address
setenv ethaddr 00:09:df:88:34:26
saveenv

#bootcmd
setenv bootcmd 'nand read.e 81000000 KL; bootm 81000000;'
saveenv

#bootdelay
setenv bootdelay 0
saveenv

printenv

## Read all 64M to RAM,
## then copy 64M from RAM to USB
#rsv good
#nand read.raw 80400000 0x0 0x41EF800
#fatwrite usb 0:1 80400000 factory.bin 0x41EF800

## KL=0x0, size=0x30FC00
## CONF=0x339000, size=0xB37000
## UBIA=0xEB2000, size=0x166E000
## PARA=0x41DF000,size=0x4200
#reset

% <- this is end of file symbol
